home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / gfa / gfa_enforcer.txt next >
Text File  |  1999-07-21  |  2KB  |  104 lines

  1. GFA-Basic: Errors
  2. -----------------
  3.  
  4. GFA-Basic is known to throw a lot of Enforcer hits.
  5.  
  6. The TITLEW command accessses illegal memory addresses. Thus you should
  7. not use this command.
  8.  
  9. The following piece of code replaces the TITLEW and CLOSEW commands. Note
  10. that 3 arrays have to be DIM'ed and initialized before using the new
  11. procedures.
  12.  
  13.   @wintitle(window #, "Window Title")
  14.   
  15.   @winclose(window #)
  16.  
  17. Replace window # by the number of your window. Replace 20 by the maximum
  18. number of windows you want to use.
  19.   
  20.  
  21. GFA-Basic Fehler
  22. ----------------
  23.  
  24. GFA-Basic wirft bekanntlich eine Menge Enforcer-Hits.
  25.  
  26. Das Hauptproblem ist der Befehl TITLEW, der ungültige Speicheradressen
  27. anspricht. Statt dieses Befehls sollte direkt das Betriebssystem benutzt
  28. werden.
  29.  
  30. Die folgenden Prozeduren ersetzen die Befehle TITLEW und CLOSEW. Vor
  31. ihrer Verwendung müssen 3 Felder (Arrays) dimensioniert und initialisiert
  32. werden.
  33.  
  34.   @wintitle(window #, "Window Title")
  35.   
  36.   @winclose(window #)
  37.         
  38. Ersetzen Sie window # durch die Nummer des Fensters und 20 durch die
  39. höchste in dem Programm benutzte Fensternummer.
  40.  
  41.  
  42. Code
  43. ----
  44.  
  45. ' Initialization *** Initialisierung
  46.  
  47. DIM win%(20),cgt%(20),cgt$(20)
  48. FOR t%=0 TO 20
  49.   win%(t%)=0
  50.   cgt%(t%)=0
  51.   cgt$(t%)=""
  52. NEXT t%
  53.  
  54. ' Procedures *** Prozeduren 
  55.  
  56. PROCEDURE wintitle(win%,title$)
  57.   LOCAL a%,b%,t%,l%
  58.   IF WINDOW(win%)<>win%(win%)
  59.     cgt%(win%)=0
  60.     win%(win%)=WINDOW(win%)
  61.   ENDIF
  62.   IF cgt%(win%)>0
  63.     ~FreeMem(cgt%(win%),1000)
  64.   ENDIF
  65.   cgt%(win%)=AllocMem(1000,65539)
  66.   IF cgt%(win%)>0
  67.     a%=WINDOW(win%)
  68.     cgt$(win%)=title$+CHR$(0)
  69.     b%=VARPTR(cgt$(win%))
  70.     l%=LEN(cgt$(win%))
  71.     IF (l%>0)
  72.       BMOVE V:cgt$(win%),cgt%(win%),l%
  73.     ELSE
  74.       POKE cgt%(win%),0
  75.     ENDIF
  76.     ~SetWindowTitles(a%,cgt%(win%),cgt%(win%))
  77.   ENDIF
  78. RETURN
  79.  
  80. PROCEDURE winclose(win%)
  81.   win%(win%)=TIMER
  82.   CLOSEW #win%
  83. RETURN
  84.  
  85.  
  86. Distribution
  87. ------------
  88.  
  89. --- Public Domain ---
  90.  
  91. You may use this code in your own programs.
  92.  
  93. Sie dürfen den Code in Ihre eigenen Programme einbauen.
  94.  
  95.  
  96. Contact / Kontakt
  97. -----------------
  98.  
  99. Frank Reibold
  100. Ottberger Weg 13
  101. 31737 Rinteln
  102.  
  103. GERMANY
  104.